.class public Lcom/vividsolutions/jts/geom/Polygon;
.super Lcom/vividsolutions/jts/geom/Geometry;
.source "Polygon.java"


# static fields
.field private static final serialVersionUID:J = -0x307ffefd8dc971b5L


# instance fields
.field protected holes:[Lcom/vividsolutions/jts/geom/LinearRing;

.field protected shell:Lcom/vividsolutions/jts/geom/LinearRing;


# direct methods
.method public constructor <init>(Lcom/vividsolutions/jts/geom/LinearRing;[Lcom/vividsolutions/jts/geom/LinearRing;Lcom/vividsolutions/jts/geom/GeometryFactory;)V
    .locals 0

    .line 119
    invoke-direct {p0, p3}, Lcom/vividsolutions/jts/geom/Geometry;-><init>(Lcom/vividsolutions/jts/geom/GeometryFactory;)V

    const/4 p3, 0x0

    .line 62
    iput-object p3, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    if-nez p1, :cond_0

    .line 121
    invoke-virtual {p0}, Lcom/vividsolutions/jts/geom/Geometry;->getFactory()Lcom/vividsolutions/jts/geom/GeometryFactory;

    move-result-object p1

    invoke-virtual {p1, p3}, Lcom/vividsolutions/jts/geom/GeometryFactory;->createLinearRing(Lcom/vividsolutions/jts/geom/CoordinateSequence;)Lcom/vividsolutions/jts/geom/LinearRing;

    move-result-object p1

    :cond_0
    if-nez p2, :cond_1

    const/4 p2, 0x0

    .line 124
    new-array p2, p2, [Lcom/vividsolutions/jts/geom/LinearRing;

    .line 126
    :cond_1
    invoke-static {p2}, Lcom/vividsolutions/jts/geom/Geometry;->hasNullElements([Ljava/lang/Object;)Z

    move-result p3

    if-nez p3, :cond_4

    .line 129
    invoke-virtual {p1}, Lcom/vividsolutions/jts/geom/LineString;->isEmpty()Z

    move-result p3

    if-eqz p3, :cond_3

    invoke-static {p2}, Lcom/vividsolutions/jts/geom/Geometry;->hasNonEmptyElements([Lcom/vividsolutions/jts/geom/Geometry;)Z

    move-result p3

    if-nez p3, :cond_2

    goto :goto_0

    .line 130
    :cond_2
    new-instance p1, Ljava/lang/IllegalArgumentException;

    const-string p2, "shell is empty but holes are not"

    invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 132
    :cond_3
    :goto_0
    iput-object p1, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    .line 133
    iput-object p2, p0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    return-void

    .line 127
    :cond_4
    new-instance p1, Ljava/lang/IllegalArgumentException;

    const-string p2, "holes must not contain null elements"

    invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw p1
.end method


# virtual methods
.method public clone()Ljava/lang/Object;
    .locals 4

    .line 359
    invoke-super {p0}, Lcom/vividsolutions/jts/geom/Geometry;->clone()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/vividsolutions/jts/geom/Polygon;

    .line 360
    iget-object v1, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    invoke-virtual {v1}, Lcom/vividsolutions/jts/geom/LineString;->clone()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/vividsolutions/jts/geom/LinearRing;

    iput-object v1, v0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    .line 361
    iget-object v1, p0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    array-length v1, v1

    new-array v1, v1, [Lcom/vividsolutions/jts/geom/LinearRing;

    iput-object v1, v0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    const/4 v1, 0x0

    .line 362
    :goto_0
    iget-object v2, p0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    array-length v3, v2

    if-ge v1, v3, :cond_0

    .line 363
    iget-object v3, v0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    aget-object v2, v2, v1

    invoke-virtual {v2}, Lcom/vividsolutions/jts/geom/LineString;->clone()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/vividsolutions/jts/geom/LinearRing;

    aput-object v2, v3, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_0
    return-object v0
.end method

.method protected compareToSameClass(Ljava/lang/Object;)I
    .locals 1

    .line 381
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    .line 382
    check-cast p1, Lcom/vividsolutions/jts/geom/Polygon;

    iget-object p1, p1, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    .line 383
    invoke-virtual {v0, p1}, Lcom/vividsolutions/jts/geom/LineString;->compareToSameClass(Ljava/lang/Object;)I

    move-result p1

    return p1
.end method

.method protected computeEnvelopeInternal()Lcom/vividsolutions/jts/geom/Envelope;
    .locals 1

    .line 292
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    invoke-virtual {v0}, Lcom/vividsolutions/jts/geom/Geometry;->getEnvelopeInternal()Lcom/vividsolutions/jts/geom/Envelope;

    move-result-object v0

    return-object v0
.end method

.method public getBoundaryDimension()I
    .locals 1

    const/4 v0, 0x1

    return v0
.end method

.method public getCoordinate()Lcom/vividsolutions/jts/geom/Coordinate;
    .locals 1

    .line 137
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    invoke-virtual {v0}, Lcom/vividsolutions/jts/geom/LineString;->getCoordinate()Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object v0

    return-object v0
.end method

.method public getCoordinates()[Lcom/vividsolutions/jts/geom/Coordinate;
    .locals 7

    .line 141
    invoke-virtual {p0}, Lcom/vividsolutions/jts/geom/Polygon;->isEmpty()Z

    move-result v0

    const/4 v1, 0x0

    if-eqz v0, :cond_0

    .line 142
    new-array v0, v1, [Lcom/vividsolutions/jts/geom/Coordinate;

    return-object v0

    .line 144
    :cond_0
    invoke-virtual {p0}, Lcom/vividsolutions/jts/geom/Polygon;->getNumPoints()I

    move-result v0

    new-array v0, v0, [Lcom/vividsolutions/jts/geom/Coordinate;

    const/4 v2, -0x1

    .line 146
    iget-object v3, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    invoke-virtual {v3}, Lcom/vividsolutions/jts/geom/LineString;->getCoordinates()[Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object v3

    const/4 v2, 0x0

    const/4 v4, -0x1

    .line 147
    :goto_0
    array-length v5, v3

    if-ge v2, v5, :cond_1

    add-int/lit8 v4, v4, 0x1

    .line 149
    aget-object v5, v3, v2

    aput-object v5, v0, v4

    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_1
    const/4 v2, 0x0

    .line 151
    :goto_1
    iget-object v3, p0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    array-length v5, v3

    if-ge v2, v5, :cond_3

    .line 152
    aget-object v3, v3, v2

    invoke-virtual {v3}, Lcom/vividsolutions/jts/geom/LineString;->getCoordinates()[Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object v3

    move v5, v4

    const/4 v4, 0x0

    .line 153
    :goto_2
    array-length v6, v3

    if-ge v4, v6, :cond_2

    add-int/lit8 v5, v5, 0x1

    .line 155
    aget-object v6, v3, v4

    aput-object v6, v0, v5

    add-int/lit8 v4, v4, 0x1

    goto :goto_2

    :cond_2
    add-int/lit8 v2, v2, 0x1

    move v4, v5

    goto :goto_1

    :cond_3
    return-object v0
.end method

.method public getDimension()I
    .locals 1

    const/4 v0, 0x2

    return v0
.end method

.method public getExteriorRing()Lcom/vividsolutions/jts/geom/LineString;
    .locals 1

    .line 225
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    return-object v0
.end method

.method public getInteriorRingN(I)Lcom/vividsolutions/jts/geom/LineString;
    .locals 1

    .line 233
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    aget-object p1, v0, p1

    return-object p1
.end method

.method public getNumInteriorRing()I
    .locals 1

    .line 229
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    array-length v0, v0

    return v0
.end method

.method public getNumPoints()I
    .locals 4

    .line 162
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    invoke-virtual {v0}, Lcom/vividsolutions/jts/geom/LineString;->getNumPoints()I

    move-result v0

    const/4 v1, 0x0

    .line 163
    :goto_0
    iget-object v2, p0, Lcom/vividsolutions/jts/geom/Polygon;->holes:[Lcom/vividsolutions/jts/geom/LinearRing;

    array-length v3, v2

    if-ge v1, v3, :cond_0

    .line 164
    aget-object v2, v2, v1

    invoke-virtual {v2}, Lcom/vividsolutions/jts/geom/LineString;->getNumPoints()I

    move-result v2

    add-int/2addr v0, v2

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_0
    return v0
.end method

.method public isEmpty()Z
    .locals 1

    .line 178
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    invoke-virtual {v0}, Lcom/vividsolutions/jts/geom/LineString;->isEmpty()Z

    move-result v0

    return v0
.end method

.method public isRectangle()Z
    .locals 13

    .line 193
    invoke-virtual {p0}, Lcom/vividsolutions/jts/geom/Polygon;->getNumInteriorRing()I

    move-result v0

    const/4 v1, 0x0

    if-eqz v0, :cond_0

    return v1

    .line 194
    :cond_0
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    if-nez v0, :cond_1

    return v1

    .line 195
    :cond_1
    invoke-virtual {v0}, Lcom/vividsolutions/jts/geom/LineString;->getNumPoints()I

    move-result v0

    const/4 v2, 0x5

    if-eq v0, v2, :cond_2

    return v1

    .line 197
    :cond_2
    iget-object v0, p0, Lcom/vividsolutions/jts/geom/Polygon;->shell:Lcom/vividsolutions/jts/geom/LinearRing;

    invoke-virtual {v0}, Lcom/vividsolutions/jts/geom/LineString;->getCoordinateSequence()Lcom/vividsolutions/jts/geom/CoordinateSequence;

    move-result-object v0

    .line 200
    invoke-virtual {p0}, Lcom/vividsolutions/jts/geom/Geometry;->getEnvelopeInternal()Lcom/vividsolutions/jts/geom/Envelope;

    move-result-object v3

    const/4 v4, 0x0

    :goto_0
    if-ge v4, v2, :cond_5

    .line 202
    invoke-interface {v0, v4}, Lcom/vividsolutions/jts/geom/CoordinateSequence;->getX(I)D

    move-result-wide v5

    .line 203
    invoke-virtual {v3}, Lcom/vividsolutions/jts/geom/Envelope;->getMinX()D

    move-result-wide v7

    cmpl-double v9, v5, v7

    if-eqz v9, :cond_3

    invoke-virtual {v3}, Lcom/vividsolutions/jts/geom/Envelope;->getMaxX()D

    move-result-wide v7

    cmpl-double v9, v5, v7

    if-eqz v9, :cond_3

    return v1

    .line 204
    :cond_3
    invoke-interface {v0, v4}, Lcom/vividsolutions/jts/geom/CoordinateSequence;->getY(I)D

    move-result-wide v5

    .line 205
    invoke-virtual {v3}, Lcom/vividsolutions/jts/geom/Envelope;->getMinY()D

    move-result-wide v7

    cmpl-double v9, v5, v7

    if-eqz v9, :cond_4

    invoke-virtual {v3}, Lcom/vividsolutions/jts/geom/Envelope;->getMaxY()D

    move-result-wide v7

    cmpl-double v9, v5, v7

    if-eqz v9, :cond_4

    return v1

    :cond_4
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .line 209
    :cond_5
    invoke-interface {v0, v1}, Lcom/vividsolutions/jts/geom/CoordinateSequence;->getX(I)D

    move-result-wide v2

    .line 210
    invoke-interface {v0, v1}, Lcom/vividsolutions/jts/geom/CoordinateSequence;->getY(I)D

    move-result-wide v4

    const/4 v6, 0x1

    move-wide v7, v4

    move-wide v3, v2

    const/4 v2, 0x1

    :goto_1
    const/4 v5, 0x4

    if-gt v2, v5, :cond_9

    .line 212
    invoke-interface {v0, v2}, Lcom/vividsolutions/jts/geom/CoordinateSequence;->getX(I)D

    move-result-wide v9

    .line 213
    invoke-interface {v0, v2}, Lcom/vividsolutions/jts/geom/CoordinateSequence;->getY(I)D

    move-result-wide v11

    cmpl-double v5, v9, v3

    if-eqz v5, :cond_6

    const/4 v3, 0x1

    goto :goto_2

    :cond_6
    const/4 v3, 0x0

    :goto_2
    cmpl-double v4, v11, v7

    if-eqz v4, :cond_7

    const/4 v4, 0x1

    goto :goto_3

    :cond_7
    const/4 v4, 0x0

    :goto_3
    if-ne v3, v4, :cond_8

    return v1

    :cond_8
    add-int/lit8 v2, v2, 0x1

    move-wide v3, v9

    move-wide v7, v11

    goto :goto_1

    :cond_9
    return v6
.end method
